package com.jeeplus.modules.anny.deliveryaddress.web;

import com.jeeplus.common.json.AjaxJson;
import com.jeeplus.core.persistence.Page;
import com.jeeplus.modules.anny.deliveryaddress.entity.AnnyDeliveryAddress;
import com.jeeplus.modules.anny.deliveryaddress.service.AnnyDeliveryAddressService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

@Controller
@RequestMapping(value = "${adminPath}/deliveryaddress/annyDeliveryAddress")
public class SettingTheAddressController {
    @Autowired
    private AnnyDeliveryAddressService annyDeliveryAddressService;

    AjaxJson j = new AjaxJson();

    @ResponseBody
    @RequestMapping(value = "settingTheAddress")
    public AjaxJson settingTheAddress(String id, HttpServletResponse response) {
        //用户id
        String userid ="1";
        // id 收货地址id
            boolean flag = annyDeliveryAddressService.settingTheAddress(id,userid);
        if (flag){
            j.setSuccess(true);
            j.setMsg("地址修改成功！");
            return j;
        }
        j.setSuccess(false);
        j.setErrorCode("-1");
        j.setMsg("地址修改失败！");
        return j;
    }
}
